package com.jy.adscm.hcPlan.mapper.mysql;

import com.jy.adscm.hcPlan.bean.HcPlanMakePartMaterielExample;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.jy.adscm.hcPlan.bean.support.HcPlanMakePartMaterielExampleSupport;
import com.jy.adscm.hcPlan.bean.support.HcPlanMaterielExportPrintSupport;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 单批次零件制造对应的物料需求 Mapper 接口
 * </p>
 *
 * @author yyy
 * @since 2018-08-23
 */
@Mapper
public interface HcPlanMakePartMaterielExampleMapper extends BaseMapper<HcPlanMakePartMaterielExample> {

    public List<HcPlanMakePartMaterielExampleSupport> getAllFinalPartMaterielExample();

    /**
     * 获取所有供应商
     * @return
     */
    public  List<Map<String,Object>> getAllSupplier();
    /**
     * 根据供应商ID获取名称
     * @return
     */
    @Select("SELECT CPD.APPLYNAME FROM cg_providerandbomdetail CPD WHERE CPD.DID = #{supplierId}")
    public  String getSupplierById(@Param("supplierId") String supplierId);


    /**
     * 获取某一天的最大的并单序号
     * @param merge
     * @return
     */
    @Select("SELECT MAX(merge_sort_num) merge_sort_num FROM hc_plan_make_part_materiel_example WHERE merge_puchase_id LIKE '${merge}%'")
    public Integer getMaxMergeSortNum(@Param("merge") String merge);


    List<HcPlanMaterielExportPrintSupport> getAllMaterielExprotPrintMsg(@Param("date")String date);
}
